# coding:utf-8
from sqlalchemy import create_engine
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import sessionmaker
import base64

import os
import re
from models import *

from settings import *
import  urllib3
import re
import time

engine = create_engine(DATABASE_URL)
Session = sessionmaker(bind=engine)

session = Session()

from selenium import webdriver


class BCYCrawer(object):
    base_url = 'http://meizitu.com/a/more_{0}.html'

    def __init__(self):
        self.driver = webdriver.Firefox()
        #self.driver.get(self.get_url())
        #last_item = self.driver.find_elements_by_css_selector("#wp_page_numbers li a")[-1].get_attribute("href")
        #self.last = int(re.search("more_(\d+)\.html", last_item).groups()[0])
        #self.init()

    def start(self):
        print("hello world")

bcyCrawer = BCYCrawer()
bcyCrawer.start()
